package com.weddingee.action.user;

import com.weddingee.action.base.BaseAction;
import com.weddingee.dao.user.UserDao;
import com.weddingee.exception.DaoException;
import com.weddingee.util.Constants;
import com.weddingee.util.DaoFactory;

public class UserAction extends BaseAction{
	private UserDao userDao = (UserDao)DaoFactory.create(6);
	private Long uid;
	
	/** 结果码 */
	private int resultCode = Constants.RESULT_CODE_ERROR;
	
	/**
	 * 删除用户
	 * @return
	 */
	public String deleteUser(){
		if( null == uid ){
			log.error("参数错误.");
			return ERROR;
		}
		
		try {
			userDao.delete(uid);
			resultCode = Constants.RESULT_CODE_SUCCESS;
			return SUCCESS;
		} catch (DaoException e) {
			log.error("删除用户出错。");
			return ERROR;
		}
	}

	public int getResultCode() {
		return resultCode;
	}
	
}
